import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../common/routes.dart';
import '../service/auth_service.dart';

class AuthMiddleWare extends GetMiddleware {
  @override
  RouteSettings? redirect(String? route) {
    if (!Get.find<AuthService>().isLogIn) {
      return const RouteSettings(name: Routes.LOGIN);
    }
    return super.redirect(route);
  }
}
